<?php

use think\migration\Migrator;
use think\migration\db\Column;

class ProjectBudgets extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table = $this->table('project_budgets', array('engine' => 'MyISAM', 'comment' => '项目预算表（主表）'));
        $table->addColumn('project_id', 'integer', array('limit' => 11, 'default' => 0, 'comment' => '项目id'))
            ->addColumn('name', 'string', array('limit' => 255, 'default' => '', 'comment' => '项目名称'))
            ->addColumn('executive_id', 'integer', array('limit' => 11, 'default' => 0, 'comment' => '主管id'))
            ->addColumn('examine_admin_id', 'integer', array('limit' => 11, 'default' => 0, 'comment' => '审核人员'))
            ->addColumn('executive', 'string', array('limit' => 155, 'default' => '', 'comment' => '项目主管'))
            ->addColumn('execution_area', 'string', array('limit' => 50, 'comment' => '执行区域', 'null' => true))
            ->addColumn('start_time', 'string', array('limit' => 50, 'default' => '', 'comment' => '开始时间'))
            ->addColumn('end_time', 'string', array('limit' => 255, 'default' => '', 'comment' => '结束时间'))
            ->addColumn('sample_num', 'integer', array('limit' => 11, 'default' => 0, 'comment' => '样本总量'))
            ->addTimestamps()
            ->addSoftDelete()
            ->create();
    }
}
